﻿#if SCRIPTSHARP
using Db7.SS;
#endif
using System.Collections.Generic;
using System;
using Db7;
using System.Collections;


namespace Db7_ut.DomainObjects
{
    public class EmployeeList 
    {
        private List<Employee> _Employees;
        public List<Employee> Employees
        {
            get { return this._Employees; }
            set { this._Employees = value; }
        }
        

        public void PopulateClientSide()
        {
            this.Employees = new List<Employee>();
            for (int i = 0; i < 1000; i++)
            {
                Employee emp = new Employee();
                emp.ID = i.ToString();
                this.Employees.Add(emp);
            }
        }

        public void Populate(Action Callback)
#if SCRIPTSHARP
        {
            RemoteCallSettings rcs = new RemoteCallSettings(this);
            rcs.CallbackOnSuccess = Callback;
            Remote.Invoke(rcs);
        }
#else
        {
            this.Employees = new List<Employee>();
            for (int i = 0; i < 100; i++)
            {
                var emp = new Employee
                {
                    ID  = i.ToString(),
                };
                this.Employees.Add(emp);
            }
        }
#endif
        


    }
}